{{extend 'zlayout.html'}}

<h2 class="fancy">{{=XML(T('Member Preferences'))}}</h2>

{{if view_info['errors']:}}
    <p class="err">{{=XML(T('There was one or more errors while processing your request, please correct the following'))}}</p>
    <ul>
        {{for error in view_info['errors']:}}
            <li class="err">{{=XML(T(error))}}</li>
        {{pass}}
    </ul>
{{pass}}

<form method="post" id="user_edit_form" action="" enctype="multipart/form-data">
    <fieldset id="user_edit_form_fields">
        <input type="hidden" id="form_submitted" name="form_submitted" value="1" />
        <input type="hidden" id="username" name="username" value="{{=username}}" />

        <table cellspacing="2" cellpadding="2">
            <tbody>
                <tr>
                    <td>{{=XML(T('Username'))}}:</td>
                    <td><a href="{{=URL(r=request, c='pm', f='message_new', args=[username])}}" title="" class="linkb">{{=username}}</a></td>
                </tr>
                <tr>
                    <td>{{=XML(T('Email'))}}:</td>
                    <td><a href="mailto:{{=user_email}}" title="{{=user_email}}">{{=user_email}}</a></td>
                </tr>
                <tr>
                    <td>{{=XML(T('New Password'))}}:</td>
                    <td><input type="password" style="width:500px;" class="formelem" name="new_passwd" id="new_passwd"
                    value="" /> <i class="note">* {{=XML(T('Leave empty for no change'))}}</i></td>
                </tr>
                <tr>
                    <td>{{=XML(T('New Password Confirmation'))}}:</td>
                    <td><input type="password" style="width:500px;" class="formelem" name="new_passwd_confirm" id="new_passwd_confirm"
                    value="" /> <i class="note">* {{=XML(T('Leave empty for no change'))}}</i></td>
                </tr>
                <tr>
                    <td>{{=XML(T('Real Name'))}}:</td>
                    <td><input type="text" style="width:500px;" class="formelem" name="real_name" id="real_name"
                    value="{{=request.vars.get('real_name', view_info['props']['real_name'])}}" /></td>
                </tr>
                <tr>
                    <td>{{=XML(T('Web Page'))}}:</td>
                    <td><input type="text" style="width:500px;" class="formelem" name="web_page" id="web_page"
                    value="{{=request.vars.get('web_page', view_info['props']['web_page'])}}" /></td>
                </tr>
                <tr>
                    <td>{{=XML(T('City/Country'))}}:</td>
                    <td><input type="text" style="width:500px;" class="formelem" name="country" id="country"
                    value="{{=request.vars.get('country', view_info['props']['country'])}}" /></td>
                </tr>
                <tr>
                    <td>{{=XML(T('Signature'))}}:</td>
                    <td>
                        <textarea id="signature" name="signature" cols="0" rows="0" class="formelem code"
                        style="width:500px;height:100px;">{{=request.vars.get('signature', view_info['props']['signature'])}}</textarea>
                    </td>
                </tr>
                <tr>
                    <td>{{=XML(T('Display Language'))}}:</td>
                    <td>
                        <select id="lang_code" name="lang_code">
                            <option value="">{{=XML(T('System Default'))}}</option>
                            {{if available_languages:}}
                                {{for lang in available_languages:}}
                                    <option value="{{=lang.language_code}}"
                                        {{if request.vars.get('lang_code', view_info['props']['locale']) == lang.language_code:}}
                                            selected="selected"
                                        {{pass}}>{{=XML(lang.language_desc)}}</option>
                                {{pass}}
                            {{pass}}
                        </select>
                    </td>
                </tr>
                <tr>
                    <td><label for="allow_pm_use">{{=XML(T('Allow contact via PM'))}}:</label></td>
                    <td>
                        <input type="checkbox" id="allow_pm_use" name="allow_pm_use"
                        {{if request.vars.get('allow_pm_use', view_info['props']['allow_pm_use']):}}checked="checked"{{pass}} />
                    </td>
                </tr>
                <tr>
                    <td>{{=XML(T('Posts'))}}:</td>
                    <td>{{=view_info['props']['postings']}}</td>
                </tr>
                <tr>
                    <td>{{=XML(T('Last Login'))}}:</td>
                    <td>{{=view_info['props']['last_login']}}</td>
                </tr>
                <tr>
                    <td>{{=XML(T('Forum Subscriptions'))}}:</td>
                    <td>
                        {{if len(forum_subscriptions):}}
                            <select id="remove_forum_subscription" name="remove_forum_subscription" multiple="multiple"
                                    style="width:500px;height:100px;">
                                {{for f_sub in forum_subscriptions:}}
                                    <option value="{{=f_sub.id}}">{{=f_sub.forum_title}}</option>
                                {{pass}}
                            </select>
                        {{else:}}
                            {{=XML(T('User is not subscribed to any forum'))}}
                        {{pass}}
                    </td>
                </tr>
                <tr>
                    <td>{{=XML(T('Topic Subscriptions'))}}:</td>
                    <td>
                        {{if len(topic_subscriptions):}}
                            <select id="remove_topic_subscription" name="remove_topic_subscription" multiple="multiple"
                                    style="width:500px;height:100px;">
                                {{for f_sub in topic_subscriptions:}}
                                    <option value="{{=f_sub.id}}">{{=f_sub.title}}</option>
                                {{pass}}
                            </select>
                        {{else:}}
                            {{=XML(T('User is not subscribed to any topics'))}}
                        {{pass}}
                    </td>
                </tr>
                <tr>
                    <td>{{=XML(T('Avatar'))}}:</td>
                    <td>
                        {{if forumhelper.has_member_avatar(username):}}
                            <img src="{{=URL(r=request, c='zadmin', f='get_avatar_image', args=[username])}}" alt="" />
                            <label for="remove_avatar">{{=XML(T('Disable'))}}:</label>
                            <input type="checkbox" id="remove_avatar" name="remove_avatar" {{if request.vars.get('remove_avatar', ''):}}checked="checked"{{pass}} />
                            <br />
                        {{pass}}
                        <input type="file" id="avatar_data" name="avatar_data" />
                    </td>
                </tr>
            </tbody>
        </table>

        <p class="note">{{=XML(T('For Forums/Topics subscriptions, select the ones you wish to unsubscribe from and submit your form'))}}.</p>

        <div class="both-separator">
            <input type="submit" id="update_b" name="update_b" value="{{=XML(T('Update Profile'))}}" />
            <input type="submit" id="cancel_b" name="cancel_b" value="{{=XML(T('Cancel'))}}" />
        </div>
    </fieldset>
</form>
